<div id="main_content">
    <h3><?php echo $title; echo $this->session->userdata('cboLeavetype');?></h3>
    <a class="btn addEmoloyeeBack m10" href="<?php echo base_url(); ?>leaveregistration"><?php echo $this->lang->line('LR_Back'); ?></a>
    <div class="form_add">
        <form name="frmovertime" id="frmovertime" method="POST" action="">
            <table class="add_data">
                <tr>
                    <td align="right">
                           <label><?php echo $this->lang->line('LR_Employee'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                        <?php if(isset($Employee) && count($Employee)){?>
                            <input type="text" name="txtEmployee" id='Employee' size="20" value="<?php echo $Employee['EmployeeName']; ?>" readonly>       
                            <a class="new_regis1" href="<?php echo base_url(); ?>leaveregistration/listemployee"><?php echo $this->lang->line('LR_Search'); ?></a>
                            <input type="hidden" name="hidEmployeeId" value="<?php echo $Employee['EmployeeId']; ?>" />
                        <?php }
                        else{
                        ?>
                            <input type="text" name="txtEmployee" id='Employee' size="20" value="<?php echo $txtEmployee; ?>" readonly>
                            <a class="new_regis1" href="<?php echo base_url(); ?>leaveregistration/listemployee"><?php echo $this->lang->line('LR_Search'); ?></a>
                            <input type="hidden" name="hidEmployeeId" value="" />                        
                        <?php
                        }
                        ?>
                        <span class="error" ><?php echo form_error('txtEmployee'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <label><?php echo $this->lang->line('LR_LeaveType'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                        <select name="cboLeavetype" class="select_option">
                            <option value="0"><?php echo $this->lang->line('LR_leavetype'); ?></option>
                            <?php if(count($data)){
                                foreach ($data as $row){?>
                                <option value="<?php echo $row['LeaveTypeId']; ?>" <?php if(isset($cboLeavetype) && $cboLeavetype==$row['LeaveTypeId']){echo "selected='selected'";} ?> ><?php echo $row['LeaveTypeName']; ?></option>
                            <?php }}?>
                        </select>
                        <span class="error"><?php echo form_error('cboLeavetype'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                           <label><?php echo $this->lang->line('LR_StartDate'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                       <input type="text" name="txtStartDate" maxlength="10" class="datepicker" size="20" value="<?php echo $txtStartDate; ?>"><?php echo $this->lang->line('LR_DateFormat');?>
                       <span class="error"><?php echo form_error('txtStartDate'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                         <label><?php echo $this->lang->line('LR_EndDate'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                        <input type="text" name="txtEndDate" maxlength="10" class="datepicker" size="20" value="<?php echo $txtEndDate; ?>"><?php echo $this->lang->line('LR_DateFormat');?>
                        <span class="error"><?php echo form_error('txtEndDate'); ?></span>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                         <label><?php echo $this->lang->line('LR_StartTime'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                        <input type="text" name="txtStartTime" maxlength="5" size="20" value="<?php echo $txtStartTime; ?>"><?php echo $this->lang->line('LR_TimeFormat');?> 
                        <span class="error"><?php echo form_error('txtStartTime'); ?></span>
                    </td>                    
                </tr>
                <tr>
                    <td align="right">
                         <label><?php echo $this->lang->line('LR_EndTime'); ?> <font color="#FF0000">(*)</font></label>
                    </td>
                    <td>
                        <input type="text" name="txtEndTime" maxlength="5" size="20" value="<?php echo $txtEndTime; ?>"><?php echo $this->lang->line('LR_TimeFormat');?> 
                        <span class="error"><?php echo form_error('txtEndTime'); ?></span>
                    </td>                     
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="hidden" value="<?php echo  $this->uri->segment(2); ?>" name="hidSegment" >
                        <input type="submit" value="<?php echo $this->lang->line('LR_Submit'); ?>" name="btnSubmit" >
                    </td>
                </tr>
            </table>
        </form>
    </div>
</div>
<!-- BEGIN dialog message -->
<div id="dialog" title="<?php echo $this->lang->line('LR_dialog_title'); ?>">
    <?php echo isset($message) ? $message : ''; ?>
</div>
<script type="text/javascript">
    $(document).ready(function() {
        $('.new_regis1').click(function(e) {
            e.preventDefault();
            var url = $(this).attr('href');
            if (url != 'javascript:void(0)') {
                $('#frmovertime').attr('action', url);
                $('#frmovertime').submit();
            }
        });        
        $(function() {
            $(".datepicker").datepicker({
                dateFormat: 'yy/mm/dd',
                showOn: "button",
                buttonImage: "<?php echo base_url(); ?>/public/sites/images/calendaricon.gif",
                buttonImageOnly: true,
                changeMonth: true,
                changeYear: true,
            });
        }); 
<?php if (isset($flag) && $flag == TRUE): ?>
            $(function() {
                $("#dialog").dialog({
                    modal: true,
                    close: function() {
                        window.location.href = '<?php echo base_url('/leaveregistration'); ?>';
                    },
                    buttons: [{
                        text: "<?php echo $this->lang->line('MC019');?>",
                        click: function() {
                            window.location.href = '<?php echo base_url('/leaveregistration'); ?>';
                        },
                    }]
                });
            });
<?php elseif (isset($flag) && $flag == FALSE): ?>
            $(function() {
                $("#dialog").dialog({
                buttons: [
                    { text: "<?php echo $this->lang->line('MC019');?>", click: function() { $( this ).dialog( "close" ); } }
                ]
                });
            });
<?php endif; ?>        
     });
</script>        